package com.linux.huhx;

import java.io.Console;

/**
 * Created by huhx on 2017-06-19.
 */
public class ConsoleTest1 {
    public static void main(String[] args) {
        Console console = System.console();
        if (console != null) {
            String name = console.readLine();
            String pwd = String.valueOf(console.readPassword("Enter password"));
            System.out.println("user name: " + name);
            System.out.println("user pwd: " + pwd);
        } else {
            System.out.println("console is unvaliable");
        }
    }
}
